package org.demo.test;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.log4j.PropertyConfigurator;
import org.boxlayout.gui.BoxLayoutEngine;
import org.boxlayout.gui.BoxLayoutFrame;
import org.boxlayout.gui.VisualElement;
import org.boxlayout.gui.layout.LayoutFactory;
import org.boxlayout.gui.type.ColorEnum;




public class TextTextureTest2d {
	
	public TextTextureTest2d() {
		final Log log = LogFactory.getLog("main");
    	PropertyConfigurator.configure("log4j.properties");
    	BoxLayoutFrame blf  = new BoxLayoutFrame();
    	BoxLayoutEngine ble = blf.getBoxLayoutEngine();
    	ble.setOrtho(true);
    	ble.getCamera2d().setViewBoundaries(-10f, 10f, -10f, 10f);
    	final VisualElement root = ble.createElement()
    	.setLayout(LayoutFactory.getInstance().getVerticalLayout())
    	.setX(-10f).setY(5f)
    	 	//.setPreferedWidth(2.0f).setPreferedHeight(2.0f)
    	;
    	
    	VisualElement hc = ble.createElement().setLayout(LayoutFactory.getInstance().getHorizontalLayout());
    	root.add(hc);
    	
    	VisualElement ve = ble.createElement();
    	ve.setText("!azertyu");
    	ve.setTexturedText(true);
    	ve.setColor(ColorEnum.PINK);
    	ve.setTextSize(2f);
    	ve.setAlpha(0.1f);
    	//ve.setPreferedWidth(4.0f).setPreferedHeight(4.0f);
    	hc.add(ve);

    	
    		ve = ble.createElement();
        	ve.setText("Aa_bc");
        	ve.setTexturedText(true);
        	ve.setTextSize(1f);
        	//ve.setAlpha(0.1f);
        	ve.setColor(ColorEnum.GREEN);
        	hc.add(ve);
        	
        	ve = ble.createElement();
        	ve.setText("g");
        	ve.setTexturedText(true);
        	ve.setTextSize(1f);
        	ve.setColor(ColorEnum.YELLOW);
        	//ve.setAlpha(0.1f);
        	hc.add(ve);
    	
    	for(Float i=0.1f;i<5f;i*=1.3f){
    		ve = ble.createElement();
        	ve.setText("aAIcdefghijklmnopqrst&é\"'(-è_çà)");
        	ve.setTexturedText(true);
        	ve.setColor(ColorEnum.GRAY);
        	ve.setTextSize(i);
        	ve.setAlpha(1f);
        	root.add(ve);
    	}
    	
    	
    	ble.setRootElement(root);
    	
    	
    	;
    	blf.start();
    	ble.reLayout();
    	log.info(root.serializeToText(""));
    	
    	
	}
	
	
	public static void main(String[] args) {
		new TextTextureTest2d();
	}

}
